<template>
	<view class="back">
		<view style="width: 100%;height:5vh;margin-top: 5vh">
			<view style="margin-left: 5vw;display: flex; align-items: center;height:5vh;"><text style="color: #fff;">{{venuename}}</text></view>
		</view>
		<view class="div2">
			<view class="div2-2" style="display: flex; align-items: center; justify-content: center;color: #636363;" @click="goSearch()">
			    <view style="float: left;"><u-icon name="search" size="38rpx" color="#636363"></u-icon></view>
			    <view style="float: left; margin-left: 10rpx;letter-spacing: 2px;font-size: 28rpx;"><text>查找相关订单</text></view>
			</view>
		</view>
		
		<view style="width: 100vw;height: 80vh;background: #fff;margin-top: 30rpx;border-radius: 70rpx 70rpx 0rpx 0rpx;padding-bottom:5vh;">
		
			<view style="overflow: auto;height: 75vh;width: 100%;">
				<view style="width: 90%;padding: 40rpx;">
				<view style="float: left;">
					课程详情
				</view>
				<!-- @tap="openTrain(item)" -->
				<view  style="float: right;width:100rpx;color:#fff;height: 50rpx; border-radius: 10rpx; background-image: linear-gradient(to bottom right, #94A9FD, #9ECFFF, #b9e1ff); display: flex; align-items: center; justify-content: center;">
				  <text style="letter-spacing: 4px;font-size: 24rpx;" @click="seriesInsert">&nbsp;+新增</text>
				</view>
				</view>
				<view style="width: 90%;padding: 40rpx;" >
					<view @tap="openTrain(item)" style="width: 100%;background-color: #fff;margin: 0 auto;padding: 20rpx;box-sizing: border-box;box-shadow: 0 2px 10px #dfdfdf;margin-bottom: 18px;" v-for="item in planList">
						<view style="height: 50rpx;">
							<view style="float: left;"><u-icon name="calendar" size="45rpx" color="#000000"></u-icon></view>
							<view style="float: left;">{{item.fitnessPlanName}}</view>
							<view style="float: right;color: #5C5C5C;font-size: 25rpx;margin-top: 5rpx;">预约时间</view>
						</view>
						<view style="width: 85vw;background-color: #F7F7F7;margin: 0 auto;height: 160rpx;padding: 5px;box-sizing: border-box;margin-top: 10rpx;">
							<view style="width: 160rpx;height: 160rpx;float: left;">
								<image class="imagg" :src="'http://101.43.223.224:8765/image/getImageById?id=6221'"></image>
							</view>
							<view style="font-size: 26rpx;float: left;color: #5C5C5C;width: 220px;">
								<view style="height: 35rpx;">
									
									<view style="float: left;">发布时间：<span>{{item.createTime}}</span><span style="margin-left:4px;">{{item.trainingTime}}</span></view>
								</view>
								<view style="margin-top:20rpx;height: 35rpx;">
									
									<view style="float: left;">教练姓名：{{item.memberUserRealName}}</view>
								</view>
								<view style="height: 50rpx; display: flex; justify-content: flex-end;">
								  <view style="width: 140rpx;">
<!-- 								    <view @click="" style="color:#fff;height: 50rpx; border-radius: 10rpx; background-color: rgb(60, 156, 255); display: flex; align-items: center; justify-content: center;">
								      <text style="letter-spacing: 2px;">&nbsp;编辑
								      </text>
								    </view> -->
								  </view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view style="width: 100%;height: 200rpx;background: #fff;border-radius: 60rpx 60rpx 0rpx 0rpx;padding-bottom:20rpx;box-shadow: 0 2px 10px #dfdfdf;">
				<view style="height:30rpx"></view>
				<view @click="fan" style="margin-left: 100rpx;float: left;width:200rpx;color:#fff;height: 70rpx; border-radius: 10rpx; background-image: linear-gradient(to bottom right, #94A9FD, #9ECFFF, #b9e1ff); display: flex; align-items: center; justify-content: center;">
				  <text style="letter-spacing: 4px;font-size: 24rpx;">&nbsp;返回</text>
				</view>
				<view  style="margin-right: 100rpx;float: right;width:200rpx;color:#fff;height: 70rpx; border-radius: 10rpx; background-image: linear-gradient(to bottom right, #94A9FD, #9ECFFF, #b9e1ff); display: flex; align-items: center; justify-content: center;">
				  <text style="letter-spacing: 4px;font-size: 24rpx;">&nbsp;确定</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item:{},
				planArray:[],
				planFrom:{
				    fitnessPurposeId:"",
					xuan1: false,
				    planActionArray:[],
				},
				messageText:'',
				title: 'picker',
				errTitle:'',
				selectedIndex:0,
				selectPlan:{},
				selectId:0,
				venuename : uni.getStorageSync('venuename'),
				multiArray: [
				],
				index: 0,
				show: false,
				errShow:false,
				courseList: [
				],
				planList:[],
					current: 0,
					selectStatus:1,
					dayOfMonth: 0,
					daySelect: 0,
					today: '',
					msgType: 'sussess'
			}
		},
		onLoad(option) {
			this.$on('pageRefresh', this.onLoad);
			this.item = JSON.parse(option.item) //打印出上个页面传递的参数。
			this.getReservation()
			this.getPlan()
			this.getAction()
		},
		methods: {
			seriesInsert(){
				uni.navigateTo({
					url: '/pages/class/seriesInsertcopy?item='+JSON.stringify(this.item)
				})
			},
			del(item){
				var ths=this
				uni.request({
					url: this.URL+'plan/deleteFitnessPlan',
					method: 'delete',
					data: item,
					// userInfo:res.
					success: function(res) {
						if(res.data.code==200){
							
							ths.getPlan()
						}else{
							
						}
						
					},
					fail: function(error) {
						// 处理请求失败
						console.error('删除失败');
					}
				})
			},
			fan(){
				uni.navigateBack({
				        delta: 1 // 返回的页面数，这里是返回上一页，所以是1
				    });
			},
			getAction() {
				
			},
			selectUser(item){
				this.selectId=item.id
			},
			handleChange(event) {
				const selectedIndex = event.detail.value; // 获取选中的索引
				const selectPlan = this.planList[selectedIndex]; // 获取选中的对象数据
				var ths = this;
				uni.request({
					url: this.URL+'vipPlan/memberAddPlan',
					method: 'POST',
					data: {
						memberId: ths.selectId,
						seriesId: selectPlan.id
					},
					// userInfo:res.
					success: function(res) {
						if(res.data.code==200){
							this.getReservation()
							ths.show=true
							setTimeout(() => {
							        ths.show = false;
							      }, 2000);
						}else{
							ths.errShow=true
							ths.errTitle=res.data.data
							setTimeout(() => {
							        ths.errShow = false;
							      }, 2000);
						}
						
					},
					fail: function(error) {
						// 处理请求失败
						console.error('角色查询失败,请检查网络');
					}
				})
				
			},
			getReservation(){
				var ths = this;
				uni.request({
					url: this.URL+'AppCoach/getStudentByTeacherId',
					method: 'GET',
					data: {
						coachCode: uni.getStorageSync('teacherinfo').coachCode,
					},
					// userInfo:res.
					success: function(res) {
						ths.courseList = res.data.data;
					},
					fail: function(error) {
						// 处理请求失败
						console.error('角色查询失败,请检查网络');
					}
				})
			},
			getPlan(){
				var ths = this;
				uni.request({
					url: this.URL+'plan/getFitnessPlan',
					method: 'GET',
					data: {
						fitnessSeriesId: this.item.id,
						venueUniqueIdentifier:uni.getStorageSync('teacherinfo').venueUniqueIdentifier
					},
					// userInfo:res.
					success: function(res) {
						ths.planList = res.data.data.content;
						console.log(ths.planList)
					},
					fail: function(error) {
						// 处理请求失败
						console.error('角色查询失败,请检查网络');
					}
				})
			},
			goSearch() {	
				
			},
			openTrain(item){
				uni.navigateTo({
					url: '/pages/class/action?item='+JSON.stringify(item)
				})
			},
		}
	}
</script>

<style>
	.title {
			font-size: 14px;
			font-weight: bold;
			margin: 20px 0 5px 0;
		}
	.data-pickerview {
			height: 400px;
			border: 1px #e5e5e5 solid;
		}
	
		 .popper__arrow {
	    top: -6px;
	    left: 50%;
	    margin-right: 3px;
	    border-top-width: 0;
	    border-bottom-color: #EBEEF5;
	}
	 .popper__arrow {
	    top: -6px;
	    left: 50%;
	    margin-right: 3px;
	    border-top-width: 0;
	    border-bottom-color: #EBEEF5;
	}
	.week-item-d1{
		background-color: #9da4ff;
		width: 23px;height:23px;
		margin: 0 auto;
		border:#92A3FD;
		border-radius: 50%;
		margin-top: 1vh;
		font-size: 28rpx;
		padding-top: 2px;
		box-sizing: border-box;
		padding-right: 3rpx;
	}
	.div2{
		width: 100%;
		height: 5vh;
	}
	.div2-2{
		background-color:#fff;
		border-radius: 20px 20px;
		height: 70rpx;
		width: 90%;
		margin: 0 auto;
	}
/* ::v-deep .div2-2 .input-placeholder {
    color: #FFF;
} */
.week-display {
	display: flex;
	justify-content: space-between;
	color: #fff;
	width: 90%;
	height: 8vh;
	margin: 0 auto;
	margin-top: 2vh;
}

.week-item {
	flex: 1;
	text-align: center;
}

.back {
	position: relative;
	width: 100%;
	height: 100vh;
	overflow: hidden; /* 超出部分隐藏，可根据需求调整 */
}

.back::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-image: linear-gradient(to bottom right,  #94A9FD,#9ECFFF,#b9e1ff);
	z-index: -1;
}
.homeclick{
	height: 70rpx;
	width: 70rpx;
	margin-top: 20rpx;
}
.dao{
	 float: left;
	 width: 50%;
	 margin: 0 auto;
	 margin-top: 20rpx;
	 height: 45rpx;
	 font-size: 25rpx;
}
.dao-1{
	 border-bottom: skyblue 3px solid;
	 width: 30%;
	 margin: 0 auto;
	 height: 45rpx;
	 display: flex;
	 justify-content: center;
	 align-items: center;
}
.dao-2{
	 width: 30%;
	 margin: 0 auto;
	 height: 45rpx;
	 display: flex;
	 justify-content: center;
	 align-items: center;
}
.imagg{
	 width: 140rpx;
	 height: 140rpx;
	 border-radius: 4px;
}
</style>
